'''
    for in循环制作乘法表
'''
for i in range(1,10):
    for j in range(1,i+1):
        a = '{}*{}={:<2}'.format(j,i,i*j)
        print(a,end='  ')
    print()
print('='*90)


for i in range(9,0,-1):
    for j in range(1,i+1):
        a = '{}*{}={:<2}'.format(j,i,i*j)
        print(a,end='  ')
    print()
print('='*90)


for i in range(1,10):
    for k in range(1,10-i):
        print('        ',end='')    # 作为制表符占位
    for j in range(i,0,-1):
        a = '{}*{}={:<2}'.format(j,i,i*j)
        print(a,end='  ')
    print()
print('='*90)


for i in range(9,0,-1):
    for k in range(1,10-i):
        print('        ',end='')    # 作为制表符占位
    for j in range(i,0,-1):
        a = '{}*{}={:<2}'.format(j,i,i*j)
        print(a,end='  ')
    print()

print('='*90)
'''
    while 函数实现乘法表部分
'''
n = 1
while n<=9:
    m = 1
    while m<=n:
        a = '{}*{}={:<2}'.format(m, n, n * m)
        m = m+1
        print(a,end='  ')
    n = n+1
    print()

print('='*90)

n = 9
while n>0:
    m = 1
    while m <= n:
        a = '{}*{}={:<2}'.format(m, n, n * m)
        m = m + 1
        print(a, end='  ')
    n = n-1
    print()

print('='*90)

n = 1
while n <= 9:
    k = 1
    m = n
    while k <= 9-n:
        print('        ',end='')
        k = k+1
    while m >= 1:
        a = '{}*{}={:<2}'.format(m, n, n * m)
        m = m - 1
        print(a, end='  ')
    n = n+1
    print()

print('='*90)

n = 9
while n >= 1:
    k = n
    m = n
    while k < 9:
        print('        ',end='')
        k = k+1
    while m >= 1:
        a = '{}*{}={:<2}'.format(m, n, n * m)
        m = m - 1
        print(a, end='  ')
    n = n-1
    print()
